package com.jeffse.light.stream.core.data.state;

import com.jeffse.light.stream.core.data.descriptor.stateDescriptor.MapStateDescriptor;
import net.sf.ehcache.Element;

import java.util.Map;

/**
 * map 类型 state
 * @param <T>
 * @param <V>
 */
public class MapState<T, V> extends State {
    public MapState(MapStateDescriptor stateDescriptor){
        super();
        this.stateDescriptor = stateDescriptor;
    }

    public Map<T, V> getMap(){
        Element element = backends.getState(stateDescriptor);
        if (element != null){
            return (Map<T, V>)element.getObjectValue();
        }
        return null;
    }

}
